#!/usr/bin/env python3
# -*- coding: utf-8 -*-
########################################################################
#
# Copyright (c) 2023 Zhiyong Lin. All Rights Reserved
#
########################################################################
'''
@File    :   mcp_server.py
@Time    :   2025/10/20 17:30:00
@Author  :   lzy2lcy 
@Version :   1.0
@Desc    :   Weather MCP Server implementation
'''
from mcp.server.fastmcp import FastMCP
from llm_client.llm_client import get_weather
from utils.logger import get_logger

logger = get_logger(__name__)

mcp = FastMCP("Weather MCP Server")

@mcp.tool()
def get_weather_info(city: str) -> dict:
    """获取指定城市的天气信息"""
    try:
        return get_weather(city)
    except Exception as e:
        logger.error(f"Failed to get weather info: {str(e)}")
        raise Exception(f"Failed to get weather info: {str(e)}")